package org.testing.model.correctQuestionAnswers;

import org.testing.model.userAnswers.UserAnswer;

public class CorrectRangeAnswer implements CorrectAnswer {

	private int startRange;
	private int stopRange;
	
	public CorrectRangeAnswer(int startRange, int stopRange) {
		this.startRange = startRange;
		this.stopRange = stopRange;
	}

	@Override
	public double equals(UserAnswer userUnswer) {
		int userChoise = Integer.parseInt(userUnswer.getAnswers()[0]);
		if(userChoise >= this.startRange && userChoise <= this.stopRange ) {
			return 1.0;
		}
		return 0;
	}

}
